package Test02;

import java.util.ArrayList;

public class PersonTest {
    public static void main(String[] args) {
        ArrayList<Person> list = new ArrayList<>();
        list.add(new Person(1, "尼古拉斯", "男"));
        list.add(new Person(2, "马尔扎哈", "男"));
        list.add(new Person(3, "迪丽热巴", "女"));
        list.add(new Person(4, "阿凡提买买提", "男"));
        list.add(new Person(5, "王宝强", "男"));
        list.add(new Person(6, "柳岩", "女"));
        for (int i = list.size() - 1; i > 0; i--) {
            String sex = list.get(i).getSex();
            if ("男".equals(sex) && list.get(i).getName().length() >= 3) {
                list.remove(i);
            } else {
                System.out.println("id:" + list.get(i).getId() + "\t" +
                        "性别:" + sex + "\t" +
                        "姓名:" + list.get(i).getName());
            }
        }
    }
}
